package com.zy.web.controller.bs;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zy.entity.bs.ClubType;
import com.zy.pojo.query.bs.ClubTypeQuery;
import com.zy.pojo.vos.common.PageVo;
import com.zy.pojo.vos.common.ResultVo;
import com.zy.service.bs.ClubTypeService;
import com.zy.web.controller.base.BaseController;
import com.zy.web.utils.ResultUtil;

@RequestMapping("bs/clubType")
@Controller
public class ClubTypeController extends BaseController {

	@Autowired
	private ClubTypeService clubTypeService;

	/**
	 * 分页
 	 * 
 	 * @param clubTypeQuery
	 * @param start
	 * @param limit
	 * @return
	 */
	@RequestMapping("pageClubType")
	@ResponseBody
	public PageVo pageClubType(ClubTypeQuery clubTypeQuery, Integer start, Integer limit) {
		return this.clubTypeService.pageClubType(clubTypeQuery, start, limit);
	}

	/**
	 * 新增
	 * 
	 * @param clubType
	 * @return
	 */
	@RequestMapping(value = "saveClubType", method = RequestMethod.POST)
	@ResponseBody
	public ResultVo saveClubType(ClubType clubType) {
		try {
			this.clubTypeService.saveClubType(clubType);
			return ResultUtil.success();
		} catch (Exception e) {
			return ResultUtil.error(log, e);
		}
	}
	
	/**
	 * 更新
	 * 
	 * @param clubType
	 * @return
	 */
	@RequestMapping(value = "updateClubType", method = RequestMethod.POST)
	@ResponseBody
	public ResultVo updateClubType(ClubType clubType) {
		try {
			this.clubTypeService.updateClubType(clubType);
			return ResultUtil.success();
		} catch (Exception e) {
			return ResultUtil.error(log, e);
		}
	}

	/**
	 * 删除
	 * 
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "removeClubType", method = RequestMethod.POST)
	@ResponseBody
	public ResultVo removeClubType(long id) {
		try {
			this.clubTypeService.removeClubType(id);
			return ResultUtil.success();
		} catch (Exception e) {
			return ResultUtil.error(log, e);
		}
	}

	/**
	 * 恢复
	 * 
	 * @param id
	 * @return
	 */
	@RequestMapping(value = "recover", method = RequestMethod.POST)
	@ResponseBody
	public ResultVo recover(long id) {
		try {
			this.clubTypeService.recover(id);
			return ResultUtil.success();
		} catch (Exception e) {
			return ResultUtil.error(log, e);
		}
	}

}